#ifndef SETTINGS_H
#define SETTINGS_H

#include <QtXml/QXmlSimpleReader>
#include <QtXml/QXmlStreamWriter>
#include <QtXml/QXmlDefaultHandler>

#include <QtCore/QSettings>
#include <QtCore/QDir>

#include <QDebug>
#include <QMap>
#include <QMapIterator>
#include <QString>

#define CAMWHORE_SETTINGS_FILE ("data\\settings.xml")

class Settings : public QXmlDefaultHandler
{
public:
	
	void load(const QString& filename = CAMWHORE_SETTINGS_FILE);
	void save(const QString& filename = CAMWHORE_SETTINGS_FILE);

	void setValue(const QString&  key, const QString& value);
	QString getValue(const QString& key);

	void addDefaultSettings();

	virtual bool fatalError(const QXmlParseException& exception);
	virtual bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
	
private:
	QMap<QString, QString> m_settings;

	bool m_settingsStarted;
};

#endif
